import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/components/Layout/layoutIndex.vue";
const judgeStyleLoseFlag = localStorage.getItem("judgeStyleLoseFlag");
const routes = [
  {
    path: "/",
    name: "home",
    component: () => import("@/views/home"),
  },
  {
    path: "/funcComp",
    name: "funcComp",
    component: Layout,
    redirect: "/funcComp/drawclass",
    meta: {
      label: "功能组件",
    },
    children: [
      {
        path: "drawclass",
        name: "drawclass",
        component: () => import("@/components/drawComp/draw"),
        meta: {
          label: "绘制类实现",
        },
      },
      {
        path: "drawv3",
        name: "drawv3",
        component: () => import("@/components/drawCompV3/draw"),
        meta: {
          label: "绘制V3组件实现",
        },
      },
      {
        path: "cssDemo",
        name: "cssDemo",
        component: () => import("@/views/cssDemo/index"),
        meta: {
          label: "css实现案例",
        },
      },
      {
        path: "topological",
        name: "topological",
        component: () => import("@/components/topological/index"),
        meta: {
          label: "拓扑图",
        },
      },
      {
        path: "goTopo",
        name: "goTopo",
        component: () => import("@/components/goTopo/indexText"),
        meta: {
          label: "go拓扑图",
        },
      },
      {
        path: "jtopo",
        name: "jtopo",
        component: () => import("@/components/topological/jtopoIndex"),
        meta: {
          label: "jtoppo拓扑图",
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
  routes,
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    };
  },
});

export default router;
